﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Net.Mime;
using DAL;
using System.Collections.Generic;
using System.ComponentModel;
using Telerik.Web.UI;
using System.Globalization;



public partial class CSManager_UserControl_uc_LapPhieu_Xem_LichSu_ChiTiet : System.Web.UI.UserControl
{
    public int _ID;
    public DateTime _Ngay;
    public int _BuoiID;
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            InitData();

        }
    }

    private void InitData()
    {

        hdfDateTime.Value = _Ngay.ToString("dd/MM/yyyy");
        hdfBuoiID.Value = _BuoiID.ToString();
        hdfID.Value = _ID.ToString();
        lblNgay.Text = _Ngay.ToString("dd/MM/yyyy");
        lblBuoi.Text = GetBuoiName();
        GetInfo();
    }
    private string GetBuoiName()
    {
        CateRouteBO cate = new CateRouteBO();

        ZD_PRC_ZD_CATE_BUOI_GETBYIDResult result = new ZD_PRC_ZD_CATE_BUOI_GETBYIDResult();
        result = cate.BuoiGet_SingleLine(int.Parse(hdfBuoiID.Value));
        return result.TENBUOI;
    }
    private void GetInfo()
    {
        DeliveryBO del = new DeliveryBO();
        DateTime dt = DateTime.ParseExact(hdfDateTime.Value, "dd/MM/yyyy", CultureInfo.InvariantCulture);

        List<ZD_PRC_ZD_DELIVERY_SO_CS_MAN_DETAIL_SEARCHResult> result = new List<ZD_PRC_ZD_DELIVERY_SO_CS_MAN_DETAIL_SEARCHResult>();
        result = del.Delivery_SO_CS_Man_Detail_Search(dt, int.Parse(hdfBuoiID.Value), int.Parse(hdfID.Value));
        grdList.DataSource = result;
        grdList.DataBind();
        if (grdList.Rows.Count > 0)
        {
            //This replaces <td> with <th> and adds the scope attribute
            grdList.UseAccessibleHeader = true;

            //This will add the <thead> and <tbody> elements
            grdList.HeaderRow.TableSection = TableRowSection.TableHeader;

            //This adds the <tfoot> element. 
            //Remove if you don't have a footer row
            //gvTheGrid.FooterRow.TableSection = TableRowSection.TableFooter;
        }
    }

}
